package xiaohu.day7.HJ71;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String reg = in.nextLine().toLowerCase();
        String str = in.nextLine().toLowerCase();
        reg = reg.replaceAll("\\*+","[a-z0-9]*").replaceAll("\\?","[a-z0-9]");
        System.out.println(str.matches(reg));
    }
}
